package com.yyq.oss.controllerOss;

import com.yyq.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author yyq
 * @create 2021-04-13 21:28
 */
@Api("上传数据")
@CrossOrigin //跨域
@RestController  //传送JOSN数据
@RequestMapping("/eduoss/file")
public class controllerOss {
    @Autowired
    private com.yyq.oss.serviceOss.serviceOss serviceOss;

    @ApiOperation("上传头像")
    @PostMapping("/uploadAvatar")
    public R uploadAvatar(MultipartFile file){
        String  url=serviceOss.uploadAvatarOss(file);
        return R.ok().data("url",url);
    }
}
